Fixed some helpers and added several tests