unit testing & refactroing