Removed last_id variable
Added bdb.session