More features and misc bug fixes