Added a couple of methods to clean up the code.