Bug fixes and directory clean-up