Initial code

first, basic implementation, more features to come