improve indentation
rewrite style
fix calculation when there is no input
improve style