core logic