Move code into subdirectories and rename to better names