[BUGFIX] Fixes issue on 6.0 and cleanup of code