changing server to work on functions
added volatile to released field, since sockets can be shared by multiple threads, albeit rarely
server to accept functions, undone!