revamp grammar, improve function syntax