Removed unused functions and tweaked allowed()