some more php logic, starting to get along with PHP more