Rewriting previous php project to be more structured