moved function definitions to header file
split up main and cweb functions