Almost complete rewrite

uses PHP now, changed some styling, more...