refactored api framework
can change client flag via slick ajax interface! nice.