Some cleanup, fix bugs added testpage.,