correct indentation and fix calculation