cleaned up code and added chainability to certain methods