Implemented logic for create element and added tests.