Functions renaming.
Minor bug and indentation.