Fixed #28, also did other things