Closed #36, various fixes