commented and cleaned up a little