Fixed some syntax issues, added wrapper function