rationalise and cleanup redundant code