Completely overhauled with Mohammed's code; rm excess files