Fixes and improvments