Functions and comments added