Core implementation

Core Implementation
Add full comments

Add full comments