Very first implementation of custom rules

along with some other minor/semi major changes