fixed definitions and improved helpers