Some fixes and functionality

Fixes and functionality