Changed modifiers and moved functions to separate class