beginning to re-write code to be more modular