Fixes according to @sw1nn's comments