Removed legacy code
Minor code refractoring