A question on $p$-groups, and order of its commutator subgroup. $\textbf{QUESTION-}$
Let $P$ be a p-group with $|P:Z(P)|\leq p^n$. Show that $|P'| \leq p^{n(n-1)/2}$.
If $P=Z(P)$ it is true. Now let $n > 1$, then
If I see $P$ as a nilpotent group and construct its upper central series, it will end , so let it be,
$e=Z_0<Z_1<Z_2<......<Z_r=P$ 
Now as $Z_{i+1}/Z_i=Z(P/Z_i)$, so if if I take some $x\in Z_2$\ $Z_1$ then $N$={$[x,y]|y\in P$} $\leq Z_1(P)$ and $N \triangleleft P $, so $P/N$ is a group with order $\leq p^{n-1}$.
Now if I let $H=P/N$ then obviously |$H/Z(H)$|$\leq p^{n-1}$.
Now $H'\cong P'N/N \cong P'/(P' \cap N)$ so from here I could finally bring $P'$ atleast into the picture, now |$P'$|=$|H'|.|P'\cap N|$ so $|P'|\leq |H'||N|$. 
This is where I am $\textbf{STUCK}$
Now , from here how can I calculate or find some power $p$ bounds on $|H'|$ and $|N|$ so i could get my result.

The case when $n=1$ is trivial, since a group $P$ such that $P/Z(P)$ is cyclic is already abelian.
Now consider a maximal subgroup $M$ containing $Z(P)$, where $[P:M]=p$. Then by induction (since $Z(P)\le Z(M)$) $|M'|\le p^{(n-1)(n-2)/2}$.
If we look at $P/M'$, then $M/M'$ is an abelian normal subgroup such that (by the second isomorphism theorem) $(P/M')/(M/M')$ is cyclic (since $P/M$ is). 
By Lemma 4.6 in FGT $|M/M'| = |P'/M'|\cdot |M/M'\cap Z(P/M')|$. 
This is the same as $|M| =|P'|\cdot |M/M'\cap Z(P/M')|$.
Let $K/M' = Z(P/M')$.  Thus we have
$$ |M| = |P'|\cdot \dfrac{|M\cap K|}{|M'|}.$$
If we can show $Z(P)\le M\cap K$, then we have
$$ |M| \ge |P'|\cdot\dfrac{|Z(P)|}{|M'|},$$
which is equivalent to 
$$ |P'| \le \dfrac{|M|\cdot |M'|}{|Z(P)|},$$
which implies
$$ |P'| \le p^{n(n-1)/2}$$
by the bound on $|M'|$, the bound on $|P/Z(P)|$, and the fact $M$ is a maximal subgroup (of index $p$).
So we already know $Z(P)\le M$ (by definition), and since the image of $Z(P)$ in $P/M'$ is central, we have $Z(P)\le K$. We are done.
