Modularized more and added 1 test