move source code to lib and rename class to rule