more js and php classes refactored