Mounting and unmounting now work but the code's a mess - time for a tidy...