Moved some functions into the manage.js file, added the `clearDialog()` function to clear modal forms. Fixed some minor bugs. Relates to issue #48