refactor module to make it more generic

• commonly used query method
update migration steps for old projects