Removed unused global tables.
Improved function name
Added documentation