Bugfixes code template fix code cleanup