Fixed margins
Updated with new code from premium version