Rewrite of mysql connection(using separate class which returns same connection)