Cleanup and additional fixes regarding procedures