cleaned up the code, split into two files
cleaned up the code, split into two files