Nonabelian Groups of order p^3 using centre and semidirect product I'm stuck in the classification of groups of order $p^3$. These were the steps i followed.
               I showed that if $|Z(G)|=p^2$ or $p^3$ then G is abelian. Hence order of centre is $p$.
            As centre is normal, G can be written as a semi direct product of $H\times K$($\times$ is semidirect product symbol) where $H$ is $Z(G)$ and $K$ is a group of order $p^2$. And let π be the homomorphism from K to Aut(H). Aut(H) is isomorphic to $Z_{p-1}$.
Now there are 2 cases depending on what K is:

(1) K is $Z_{p^2}$
          Now π : $Z_{p^2 }$ --> $Z_{p-1}$
          There aren't any homomorphisms(except the trivial) possible as no element in $Z_{p-1}$ has order $p$ or $p^2$.
(2) K is $Z_p\times Z_p$
         Again the same argument as in (1) will hold and no homomorphisms will be there except the trivial. 
   If it is trivial homomorphism then group becomes abelian($Z_{p^2}\times Z_p $ and $Z_p\times Z_p \times Z_p $ respectively)
   I ended up proving that there is no nonabelian group of order $p^3$ which is not true, hence the proof is wrong somewhere.I couldn't find the mistake. Any help/partial progress will be appreciated. 


Since $H$ is the center, $H$ commutes with everything so with $K$ also. Thus the resulting homomorphism is trivial.
Moreover, there is no $K$ in $F$ such that $G=H\times K$ since every normal subgroup of $G$ intersects nontrivially with $Z(G)$.
