Refactored some of the variable
Added backend and fix for return values