Clean up code and added data generator