Fixing font rendering issues and refactoring