Various bug fixes and reworked granite support