Minor Fix
Input detects the borders

Input detects the borders and Engine ignores them
Minor Fix
Restructured the calculate function.