Added PHP doc and fixed code layout