Added in helper functions to assist with addressing rows and columns
Fixed the energy function to return the appropriate previos energy