Fixes, a bit of optimalization