cleaned up output and added modularity