tweaking functions, adding menu support