improve code, add examples and readme