Improve code and add features