refactorized & proper tests for rules added