refactored crud to support better functionality and get data from the session