Merging in recent development into master

Fixed many issues