Fixes bracket evaluation, adds some helper functions