some updates and use of sqlalchemy