Consolidated functions and added a small margin.