Added gallery class

Fixed issues with database class