major code cleanup and fixes
added blueprint detector