Added return values for most of the functions.