Error reporting mark II
Code cleanup