Fixed #35 and added a lot of tiny modifications.