Add 'before' command function, clean up some oopsies
Code cleanup