Fixes gesture centered scaling. Tidies and optimizes code a tiny bit as well.