Bug fixes and added functionality