refactored some code to use args and renamed some stuff