Trash functionality added, various bug fixes