Added allin functionality, tidied code a bit