separated javascript functions into separate files for readability and separation of concerns