Remove redundant code and debugging info