cleaned up code improved comments