cleanup code and add some clear conventions