Added compression functions, fixed minor bugs