moved some code from (supposedly) throwaway main.py into datatypes