improved variable names and removed obsolete main function