Restructured API a bit