Bug fixed. Less hardcoded now, but PHP side is in need of some cleaning.