Optimized code and added a new variant.

Added a new variant fixing the location preferences instead of being
dynamic to further increase the code execution speed. Also improved the
comments.
More updates.