Code styling and fixes