Moved helper functions to toolkit file