Code restructure/cleanup/PHP docs