more code cleanup
tried to fix the weird color bug, but no success yet