refactor code, clean out loggin, remove php notices, tested