Clean code up, add compression support