Fixed functions

Fixed functions to deliver results needed