Added full POST support, cleaned-up code