finish the core function
finish the first version
can use some simple