Refactors several methods, more tests