cleanup and split handler
add JSON post capability