refactors and organizes tests