Reformatting code with proper spaces indention, other cleanup