Added proper namespace detection, added a method to detect dependencies and marking templated classes.