Moved checkAccess to database class and fixed manual parsing.