some final logic cleaning